import React, { useCallback, useState } from "react";


export const Search: React.FC = () => {
    const [kw, setKw] = useState("")

    // useCallback缓存函数 避免重新创建
    const onKwChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {
        setKw(e.currentTarget.value)
    },[])

    return (
        <>
            <input type="text" value={kw} onChange={onKwChange} />
            <hr />
            <p>{kw}</p>
        </>
    )
}




